# 字典习题
# 1.现有一个电话簿，实现一个查找电话的功能，比如我找Zhanglong，输出：18989227822
phonebook= {'MaYun': '13309283335',
   'ZhangLong': '18989227822',
   'ZhangMin': '13382398921',
   'Gorge': '19833824743',
   'Jordan': '18807317878',
   'Curry': '15093488129',
   'Wade': '19282937665'}
# userinput = input('请输入姓名')
# if userinput in phonebook.keys():
#     print(phonebook.get(userinput))
# else:
    # print(None)
# print(dict1.get('ZhangLong')) //通过key找到对应的值)
# 2.有如下值[11,22,33,44,55,66,77,88,99,90]，
# 将所有大于 66 的值保存至字典的第一个key中，将小于 66 的值保存至第二个key的值中
# lis5=[11,22,33,44,55,66,77,88,99,90]
# dict01={'max_num':[],'min_num':[]}
# for i in lis5:
#   if i>=66:
#      dict01['max_num'].append(i)
#   else:
#       dict01['min_num'].append(i)
# print(dict01)


# 3.现有列表，去除列表中成绩小于70的字典
score_list = [
 {"科目": "政治", "成绩": 98},#0
 {"科目": "语文", "成绩": 67},#1
 {"科目": "数学", "成绩": 99},#2
 {"科目": "历史", "成绩": 65},#3
 {"科目": "英语", "成绩": 85}#4
]


remove_index=[]
for i,e in enumerate(score_list):
     if e.get('成绩')<70:
         remove_index.append(i)
for i in remove_index[::-1]:
    score_list.pop(i)
print(score_list)

